import React, { Component } from 'react'
import PubSub from 'pubsub-js';
export default class Header extends Component {
    render() {
        return (
            <div>
                <input type="text" ref={el => this.input = el} /><button onClick={this.send}>发送</button>
            </div>
        )
    }

    send = () => {
        //获取用户输入的内容
        let v = this.input.value;
        //发布
        PubSub.publish('keyword', v);
    }
}
